package com.taptech.doufu.services;

import com.taptech.doufu.constant.Constant;
import com.taptech.doufu.listener.HttpResponseListener;
import com.taptech.doufu.net.httputils.HttpRequestObject;
import com.taptech.doufu.net.httputils.HttpUtil;

public class NovelFlowerService {

	public static final String BASE_URL = "http://" + Constant.HOST_NAME
			+ "/index.php/";
	public final static int HANDLE_TYPE_LOAD_FLOWER_RANK = 4001;
	private static NovelFlowerService instance = new NovelFlowerService();

	private NovelFlowerService() {

	}

	public static NovelFlowerService getInstance() {
		return instance;
	}



	/**
	 * 献花的用户
	 */
	public void loadFlowerRank(String novel_id, int pageIndex, int size,
			String last, HttpResponseListener listener) {
		HttpRequestObject request = new HttpRequestObject();
		request.setHandleType(HANDLE_TYPE_LOAD_FLOWER_RANK);
		request.setUrl(Constant.BASE_URL + "flower/flower_users?id=" + novel_id
				+ "&object_type=" + Constant.OBJECT_TYPE_NOVEL + "&size="
				+ size + "&last=" + last);
		request.setListener(listener);
		HttpUtil.sendGetRequest(request);
	}

	public void loadFlowerRank(String novel_id , int size , String objectType, String last, HttpResponseListener listener) {
		HttpRequestObject request = new HttpRequestObject();
		request.setHandleType(HANDLE_TYPE_LOAD_FLOWER_RANK);
		request.setUrl(Constant.BASE_URL + "flower/flower_users?id=" + novel_id
				+ "&object_type=" + objectType + "&size="
				+ size + "&last=" + last);
		request.setListener(listener);
		HttpUtil.sendGetRequest(request);
	}

}
